home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / exceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.4 KB  |  98 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef KCAL_EXCEPTIONS_H
  23. #define KCAL_EXCEPTIONS_H
  24. //
  25. // Exception classes of libkcal.
  26. //
  27. // We don't use actual C++ exceptions right now. These classes are currently
  28. // returned by an error function, but we can build upon them, if we start
  29. // to use C++ exceptions.
  30.  
  31. #include <qstring.h>
  32.  
  33. namespace KCal {
  34.  
  35. /**
  36.   KOrganizer exceptions base class. This is currently used as a fancy kind of
  37.   error code not as an C++ exception.
  38. */
  39. class Exception
  40. {
  41.   public:
  42.     /**
  43.       Construct exception with descriptive message \a message.
  44.     */
  45.     Exception( const QString &message = QString::null );
  46.     virtual ~Exception();
  47.  
  48.     /**
  49.       Return descriptive message of exception.
  50.     */    
  51.     virtual QString message();
  52.     
  53.   protected:
  54.     QString mMessage;
  55.  
  56.   private:
  57.     class Private;
  58.     Private *d;
  59. };
  60.  
  61. /**
  62.   Calendar format related error class.
  63. */
  64. class ErrorFormat : public Exception
  65. {
  66.   public:
  67.     enum ErrorCodeFormat { LoadError, SaveError,
  68.                            ParseErrorIcal, ParseErrorKcal,
  69.                            NoCalendar,
  70.                            CalVersion1,CalVersion2,
  71.                            CalVersionUnknown,
  72.                            Restriction };
  73.   
  74.     /**
  75.       Create format error exception.
  76.     */
  77.     ErrorFormat( ErrorCodeFormat code, const QString &message = QString::null );
  78.     
  79.     /**
  80.       Return format error message.
  81.     */
  82.     QString message();
  83.     /**
  84.       Return format error code.
  85.     */
  86.     ErrorCodeFormat errorCode();
  87.     
  88.   private:
  89.     ErrorCodeFormat mCode;
  90.  
  91.     class Private;
  92.     Private *d;
  93. };
  94.  
  95. }
  96.  
  97. #endif
  98.